package com.webtest.shoppingcar1;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;

/**
 * @author lzy
 * @version v1.0
 * Create DateTime: 2018/8/7 21:15
 */
public class ProcessStep1Servlet extends HttpServlet {
    private static final long serialVersionUID = -5433192458326145760L;

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //1. 选中的图书的信息
        String[] books = req.getParameterValues("book");
        //2. 把图书信息放入到HttpSession中
        HttpSession session = req.getSession();
        session.setAttribute("books", books);
        //2. 重定向到页面shoppingcar/step2.jsp
        resp.sendRedirect(req.getContextPath() + "/shoppingcart/step2.jsp");
    }
}
